<template>
	<view class="page">
		<view class="title">课程设置</view>
		<view class="content">
			<text style="display: flex;margin-left: 140rpx;margin-top: 20rpx;">
				课程名称
			</text>
			<view class="inputBlock">
			 	<input :placeholder="course_name" style="font-size: 26rpx;text-align: center;"/>
			</view>
		</view>
		
		<view class="content">
			<text style="display: flex;margin-left: 140rpx;margin-top: 20rpx;">
				起止时间
			</text>
			<view class="inputBlock">
			 	<input :placeholder="startTime + endTime" style="font-size: 26rpx;margin-left: 75rpx;"/>
			</view>
		</view>
		
		<view class="content">
			<text style="display: flex;margin-left: 140rpx;margin-top: 20rpx;">
				授课教室
			</text>
			<view class="inputBlock">
			 	<input :placeholder="classRom" style="font-size: 26rpx;margin-left: 100rpx;"/>
			</view>
		</view>
		
		<view class="save_button" @click="saveSchedule">
			<text style="display: flex;color: #FFFFFF;margin-top: 19rpx;margin-left: 45rpx;">保存</text>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				course_name:'',
				startTime:'',
				endTime:'',
				classRom:'',
			}
		},
		onLoad(e) {
			if(e.schedule){
				console.log(JSON.parse(e.schedule));
				let schedule = JSON.parse(e.schedule);
				if(schedule.course_name.trim() != '') this.course_name = schedule.course_name;
				if(schedule.course_time.trim() != '') this.startTime = schedule.course_time.split("~")[0] + '~';
				if(schedule.course_time.trim() != '') this.endTime = schedule.course_time.split("~")[1];
				if(schedule.classroom.trim() != '') this.classRom = schedule.classroom;
			}
		},
		methods: {
			saveSchedule: function(){
				uni.navigateTo({
					url: '../commitSuccess/commitSuccess'
				})
			}
		}
	}
</script>

<style>
	.page {
		width: 750rpx;
		height: 1280rpx;
		/* height: 1020rpx; */
		/* padding-bottom: 60px; */
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
		background-color: #F3F5F7;
	}
	
 	.content {
		width: 702rpx;
		height: 80rpx;
		margin-top: 27rpx;
		display: flex;
		margin-left: auto;
		margin-right: auto;
		border-radius: 40rpx;
		/* background-color: #ff007f; */
	} 
	
	.title{
		color: #FD973F;
		font-size: 18px;
		margin-top: 35rpx;
		display: flex;
		justify-content: center;
	}
	
	.inputBlock{
		background-color: #fff;
		width: 300rpx;
		height: 50rpx;
		/* margin-bottom: 30rpx; */
		border-radius: 40rpx;
		display: flex;
		/* padding-left: 30rpx; */
		
		margin-left: 20rpx;
		margin-top: 15rpx;
		/* margin-bottom: 30rpx */
		;
	}
	
	.save_button{
		margin-top: 60rpx;
		background-color: #FD973F;
		width: 150rpx;
		border-radius: 60rpx;
		height: 80rpx;
		margin-left: 300rpx;
	}
	
</style>
